//
//  AWHttpService.h
//  ArtWin
//
//  Created by YYS on 2020/8/4.
//  Copyright © 2020 YYS. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworkReachabilityManager.h>

NS_ASSUME_NONNULL_BEGIN

#define BASE_URL   @"http://101.132.90.7:10018/"
#define apiKey     @"Uh5EzhZoHtUpqSAB"

static NSInteger const ReqCodeTypeSuccess = 0;        //成功
static NSInteger const ReqCodeTypeNoNetWork = 1;      //无网络
static NSInteger const ReqCodeTypeTimeout = 2;        //超时
static NSInteger const ReqCodeTypeCalceled = 3;       //取消
static NSInteger const ReqCodeTypeOther = -1;         //其它错误

/** 成功回调Block */
typedef void(^SuccessBlock)(id responseObject);

/** 失败回调Block */
typedef void(^FailureBlock)(NSInteger errorType, id error);

/** 网络状态回调 */
typedef void(^ReachBilityStatusBlock)(AFNetworkReachabilityStatus status);

@interface AWHttpService : NSObject

+(AWHttpService *)service;

//- (void)uploadImage:(UIImage *)image fileName:(NSString *)fileName
//               succ:(SuccessBlock)succ
//               fail:(FailureBlock)fail;
/// post请求
/// @param url --
/// @param param --
/// @param succ --
/// @param fail --

-(void)postWithUrl:(NSString *)url
            params:(id)param
              succ:(SuccessBlock)succ
              fail:(FailureBlock)fail;

///  网络状态监听

-(void)reachBilityStatusWithCallBack:(ReachBilityStatusBlock)block;

/// 取消所有请求

-(void)cancelAllRequest;

/// 取消所有请求
/// @param url url

-(void)cancelRequestWithURL:(NSString *)url;

@end

NS_ASSUME_NONNULL_END
